package cn.jetpiece.cloud.joss.sdk.core.oss.model;

import cn.jetpiece.cloud.joss.sdk.core.oss.model.enums.AclEnum;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

/**
 * @author XuJZ
 * @date 2020/9/10
 */

public class CreateBucket {

    /**
     * 桶名
     */
    private String bucketName;

    /**
     * 服务商id
     */
    private String providerId;

    /**
     * 域id
     */
    private String regionId;

    /**
     * 存储类型id
     */
    private String storageClassId;

    /**
     * 冗余
     *
     * @see AclEnum
     */
    private Integer dataRedundancyType;

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    public String getProviderId() {
        return providerId;
    }

    public void setProviderId(String providerId) {
        this.providerId = providerId;
    }

    public String getRegionId() {
        return regionId;
    }

    public void setRegionId(String regionId) {
        this.regionId = regionId;
    }

    public String getStorageClassId() {
        return storageClassId;
    }

    public void setStorageClassId(String storageClassId) {
        this.storageClassId = storageClassId;
    }

    public Integer getDataRedundancyType() {
        return dataRedundancyType;
    }

    public void setDataRedundancyType(Integer dataRedundancyType) {
        this.dataRedundancyType = dataRedundancyType;
    }

    public MultiValueMap<String, String> queryParams() {
        MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
        if (bucketName != null) {
            queryParams.add("bucketName", bucketName);
        }
        if (providerId != null) {
            queryParams.add("providerId", providerId);
        }
        if (regionId != null) {
            queryParams.add("regionId", regionId);
        }
        if (storageClassId != null) {
            queryParams.add("storageClassId", storageClassId);
        }
        if (dataRedundancyType != null) {
            queryParams.add("dataRedundancyType", dataRedundancyType.toString());
        }
        return queryParams;
    }
}
